package com.ziyia.a5_2_4;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void OverrideType(View view) {
        Intent intent = new Intent();
        intent.setData(Uri.parse("nsyw://aaa.bbb.ccc"));
        intent.setType("ns/yw");
        Toast.makeText(this, intent.toString(), Toast.LENGTH_SHORT).show();
    }

    public void OverrideData(View view) {
        Intent intent = new Intent();
        intent.setType("ns/yw");
        intent.setData(Uri.parse("nsyw://aaa.bbb.ccc"));
        Toast.makeText(this, intent.toString(), Toast.LENGTH_SHORT).show();
    }

    public void dataAndDataTest(View view) {
        Intent intent = new Intent();
        intent.setDataAndType(Uri.parse("nsyw://aaa.bbb.ccc"), "ns/yw");
        Toast.makeText(this, intent.toString(), Toast.LENGTH_SHORT).show();
    }

    public void dataTest(View view) {

//        Intent intent = new Intent();
//        intent.setData(Uri.parse("nsyw://"));

//        Intent intent = new Intent();
//        intent.setData(Uri.parse("nsyw://ziyia.cn"));


        Intent intent = new Intent();
        intent.setData(Uri.parse("nsyw://ziyia.cn:1000"));

//        Intent intent = new Intent();
//        intent.setData(Uri.parse("nsyw://ziyia.cn/get"));

//        Intent intent = new Intent();
//        intent.setData(Uri.parse("nsyw://ziyia.cn:2000/get"));
        startActivity(intent);
    }

    public void actionDataTest(View view) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("http://ziyia.cn"));
        startActivity(intent);
    }


}